package com.lrkj.waitress.service.impl;

import java.util.List;
import com.lrkj.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lrkj.waitress.mapper.JoinFileMapper;
import com.lrkj.waitress.domain.JoinFile;
import com.lrkj.waitress.service.IJoinFileService;

/**
 * 入伙材料Service业务层处理
 *
 * @author yajun_ren
 * @date 2022-03-18
 */
@Service
public class JoinFileServiceImpl implements IJoinFileService
{
    @Autowired
    private JoinFileMapper joinFileMapper;

    /**
     * 查询入伙材料
     *
     * @param fileId 入伙材料ID
     * @return 入伙材料
     */
    @Override
    public JoinFile selectJoinFileById(String fileId)
    {
        return joinFileMapper.selectJoinFileById(fileId);
    }

    /**
     * 查询入伙材料列表
     *
     * @param joinFile 入伙材料
     * @return 入伙材料
     */
    @Override
    public List<JoinFile> selectJoinFileList(JoinFile joinFile)
    {
        return joinFileMapper.selectJoinFileList(joinFile);
    }

    /**
     * 新增入伙材料
     *
     * @param joinFile 入伙材料
     * @return 结果
     */
    @Override
    public int insertJoinFile(JoinFile joinFile)
    {
        joinFile.setCreateTime(DateUtils.getNowDate());
        return joinFileMapper.insertJoinFile(joinFile);
    }

    /**
     * 修改入伙材料
     *
     * @param joinFile 入伙材料
     * @return 结果
     */
    @Override
    public int updateJoinFile(JoinFile joinFile)
    {
        joinFile.setUpdateTime(DateUtils.getNowDate());
        return joinFileMapper.updateJoinFile(joinFile);
    }

    /**
     * 批量删除入伙材料
     *
     * @param fileIds 需要删除的入伙材料ID
     * @return 结果
     */
    @Override
    public int deleteJoinFileByIds(String[] fileIds)
    {
        return joinFileMapper.deleteJoinFileByIds(fileIds);
    }

    /**
     * 删除入伙材料信息
     *
     * @param fileId 入伙材料ID
     * @return 结果
     */
    @Override
    public int deleteJoinFileById(String fileId)
    {
        return joinFileMapper.deleteJoinFileById(fileId);
    }

    @Override
    public int deleteByJoinRegisterId(String registerId) {
        return joinFileMapper.deleteByJoinRegisterId(registerId);
    }

    /**
     * 批量新增入伙材料信息
     *
     * @param joinFiles 入伙材料对象
     */
    public int batchAddData(List<JoinFile> joinFiles)
    {
           return joinFileMapper.batchAddData(joinFiles);
    }
}
